document.write("<script src='js/toast/native-toast.js'></script>");
var useEdge = true //边缘（左右的边缘）
var useDebug = false //debug模式，toast不自动关闭
var useSquare = true //是否使用矩形toast,默认弧形
var timeoutConf = 3000 
var pos = 'bottom'  //不使用的时候，跟系统类似，中下的地方

function toastText(msg) {
  nativeToast({
    message: msg,
    square: useSquare,
    edge: useEdge,
    timeout:timeoutConf,
    debug: useDebug
  })
}
function toastTextInfo(msg) {
  nativeToast({
    message: msg,
    type: 'info',
    icon: false,
    square: useSquare,
    edge: useEdge,
    timeout:timeoutConf,
    debug: useDebug
  })
}
function toastTextWarning(msg) {
  nativeToast({
    message: msg,
    type: 'warning',
    icon: false,
    square: useSquare,
    edge: useEdge,
    timeout:timeoutConf,
    debug: useDebug
  })
}
function toastTextError(msg) {
  nativeToast({
    message: msg,
    type: 'error',
    icon: false,
    square: useSquare,
    edge: useEdge,
    timeout:timeoutConf,
    debug: useDebug
  })
}
function toastTextSuccess(msg) {
  nativeToast({
    message: msg,
    type: 'success',
    icon: false,
    square: useSquare,
    edge: useEdge,
    timeout:timeoutConf,
    debug: useDebug
  })
}


//==============================================
//以下方法控制位置，useEdge会使得toast默认就是方形的即（square=true）,icon可配置
//有类型的icon default true
var posIcon=true;

function toastPosIconInfo(msg) {
  nativeToast({
    message: msg,
    type: 'info',
    icon: posIcon,
    square: useSquare,
    edge: useEdge,
    timeout:timeoutConf,
    position: pos,
    debug: useDebug
  })
}
function toastPosIconWarning(msg) {
  nativeToast.warning({
    message: msg,
    type: 'warning',
    icon: posIcon,
    square: useSquare,
    edge: useEdge,
    timeout:timeoutConf,
    position: pos,
    debug: useDebug
  })
}
function toastPosIconError(msg) {
  nativeToast({
    message: msg,
    type: 'error',
    icon: posIcon,
    square: useSquare,
    edge: useEdge,
    timeout:timeoutConf,
    position: pos,
    debug: useDebug
  })
}
function toastPosIconSuccess(msg) {
  nativeToast({
    message: msg,
    type: 'success',
    icon: posIcon,
    square: useSquare,
    edge: useEdge,
    timeout:timeoutConf,
    position: pos,
    debug: useDebug
  })
}

//document.getElementById('switch-edge-mode').addEventListener('change', function (e) {
//useEdge = e.target.checked
//})
//document.getElementById('switch-debug-mode').addEventListener('change', function (e) {
//useDebug = e.target.checked
//})